package com.niit.syy.Floor_area_ratio;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class Floor_area_ratioMapper extends Mapper<LongWritable, Text,Text,Text> {
    private Text outk = new Text();
    private Text outv = new Text();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String lineData = value.toString();
        String[] datas = lineData.split(",");
        if (datas.length >= 5) {  //确保有足够的列数
            outk.set(datas[1]);  // 房屋所属市辖区
            outv.set(datas[4]);  // 所在楼层
            context.write(outk, outv);
        }
    }
}